<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //合唱团
        let chior = [];
        let duck = {
            duckSinging: function(){
                console.log('嘎嘎嘎');
            }
        }
        //999
        for (let i = 0; i < 999; i++){
            chior.push(duck)
        }
        // chior.push(duck)
        let chick = {
            //有两条腿，并能嘎嘎嘎
            duckSinging:function(){
            console.log('嘎嘎嘎');
            }
        }
        if (checkIsDuck(chick)) {
            chior.push(chick)
        }
        chior.push(chick);
        /*
        *@func 检验是否是只鸭子
        *@params obj {}
        *@return boolean
        */
        function checkIsDuck(obj){
            if(obj.hasOwnProperty('duckSinging') && typeof chick.duckSinging == 'function'){
                return true;
            }
        }
        if(chior.length >= 1000) {
            console.log('招募完成');
        }
    </script>
</body>
</html>